@(plugins: List[(gitbucket.core.plugin.PluginInfoBase, Boolean, String)], info: Option[Any])(implicit context: gitbucket.core.controller.Context)
@gitbucket.core.html.main("Plugins"){
  @gitbucket.core.admin.html.menu("plugins") {
    @gitbucket.core.helper.html.information(info)
    <form action="@context.path/admin/plugins/_reload" method="POST" class="pull-right">
      <input type="submit" value="Reload plugins" class="btn btn-default">
    </form>
    <h1 class="system-settings-title">Plugins</h1>
    @if(plugins.size > 0) {
      <ul>
        @plugins.map { case (plugin, enabled, updatableVersion) =>
          <li><a href="#@plugin.pluginId">@plugin.pluginId:@plugin.pluginVersion</a></li>
        }
      </ul>

      @plugins.map { case (plugin, enabled, updatableVersion) =>
        <div class="panel panel-default">
          <div class="panel-heading strong" id="@plugin.pluginId">
            <form method="POST" class="pull-right">
              @if(enabled){
                @if(updatableVersion.nonEmpty){
                  <input type="submit" value="Update" class="btn btn-success btn-sm update-plugin" style="position: relative; top: -5px; left: 10px;"
                         data-name="@plugin.pluginName" formaction="@{context.path}/admin/plugins/@{plugin.pluginId}/@{updatableVersion}/_install">
                }
                <input type="submit" value="Uninstall" class="btn btn-danger btn-sm uninstall-plugin" style="position: relative; top: -5px; left: 10px;"
                       data-name="@plugin.pluginName" formaction="@{context.path}/admin/plugins/@{plugin.pluginId}/_uninstall">
              } else {
                <input type="submit" value="Install" class="btn btn-success btn-sm install-plugin" style="position: relative; top: -5px; left: 10px;"
                       data-name="@plugin.pluginName" formaction="@{context.path}/admin/plugins/@{plugin.pluginId}/@{plugin.pluginVersion}/_install">
              }
            </form>
            @plugin.pluginName
          </div>
          <div class="panel-body">
            <div class="row">
              <label class="col-md-2">Id</label>
              <span class="col-md-10">@plugin.pluginId</span>
            </div>
            <div class="row">
              <label class="col-md-2">Version</label>
              <span class="col-md-10">@plugin.pluginVersion</span>
            </div>
            <div class="row">
              <label class="col-md-2">Description</label>
              <span class="col-md-10 muted">@plugin.description</span>
            </div>
          </div>
        </div>
      }
    } else {
      <p>No plugin detected on your gitbucket installation.</p>
    }
  }
}
<script>
  $(function(){
    $('.uninstall-plugin').click(function(e){
      var name = $(e.target).data('name');
      return confirm('Uninstall ' + name + '. Are you sure?');
    });

    $('.install-plugin').click(function(e){
      var name = $(e.target).data('name');
      return confirm('Install ' + name + '. Are you sure?');
    });

    $('.update-plugin').click(function(e){
      var name = $(e.target).data('name');
      return confirm('Update ' + name + '. Are you sure?');
    });
  });
</script>
